% TEMPLATE FOR STANDARD QUIZ
% by laura
\documentclass[14pt,epsfig]{article}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{tikz}
\oddsidemargin=0in
\evensidemargin=0in
\textwidth=6.3in
\topmargin=-0.5in
\textheight=9in

\parindent=0in
\pagestyle{empty}

%testpoints.tex
\oddsidemargin=0in
\evensidemargin=0in
\textwidth=6.3in
\topmargin=-0.5in
\textheight=9in
\parindent=0in
\pagestyle{empty}

\newcounter{problemnum}
\renewcommand{\theproblemnum}{\arabic{problemnum}}
\newcounter{partnum}[problemnum]
\renewcommand{\thepartnum}{\alph{partnum}}
\newcounter{totalpoints}
\newcounter{curprobpts}	
\newcounter{totalparts}
\newcounter{pagepoints}
\newenvironment{problem}[1]{
\refstepcounter{problemnum}
\vspace{0.15in} \par
\setcounter{curprobpts}{#1} \setcounter{totalparts}{0}
{\Large \bf \theproblemnum. \normalsize ({\it \arabic{curprobpts} point\null\ifnum \value{curprobpts} = 1\else s\fi}\/)}
}{\ifnum \value{totalparts} = 0
	\addtocounter{totalpoints}{\value{curprobpts}}	% Add pts to total.
	\addtocounter{pagepoints}{\value{curprobpts}}
	\else \ifnum \value{totalparts} = \value{curprobpts}
	\else \typeout{}
	\typeout{!!!!!!!   POINT ACCOUNTING ERROR   !!!!!!!!}
	\typeout{PROBLEM [\theproblemnum] WAS ALLOCATED \arabic{curprobpts} POINTS,}
	\typeout{BUT CONTAINS PARTS TOTALLING \arabic{totalparts} POINTS!}
	\typeout{}
	\fi
\fi
}
\newcommand{\newpart}[1]
{
\refstepcounter{partnum}
\hspace{0.25in}	
\ifnum #1 > 0
	\makebox[0.5in][l]{{\bf \thepartnum.} {\bf ({\it #1 pt\ifnum #1 = 1\else s\fi\/}) \,\,}}
\else
	\makebox[0.25in][l]{({\bf \thepartnum})}
\fi
\hspace{0.1in}	
\addtocounter{totalparts}{#1}
\addtocounter{pagepoints}{#1}
\addtocounter{totalpoints}{#1}
}
\newcommand{\skipproblem}[1]{\addtocounter{problemnum}{#1}}

\newcommand{\showpoints}
{
\typeout{}  
\typeout{====> A TOTAL OF \arabic{totalpoints} POINTS WERE READ.}
\typeout{}
}
%%%%%end testpoints.tex
%\input{testpoints}

\begin{document}


%%%(change to appropriate class and semester)
MATH 2222HJ Spring 2016

%%%(change to appropriate quiz type and date)
Quiz 5 \hspace{1.9in} SOLUTION
\vspace{2pc}

%%%(modify rules, time, points as appropriate)
Show all work clearly and in order, and circle your final answers.  

Justify your answers algebraically whenever possible. Unjustified work may not receive full credit.
\vspace{2pc}

We will derive the formula that says the area of a triangle with height $h$ and base $b$ is $$\mathrm{Area} \left({\Delta} \right)=\dfrac{1}{2}bh.$$
Take any triangle and rotate it so that one of the legs is horizontal. Place this triangle in the coordinate plane so that the $y$-axis goes through the top vertex and the bottom leg lies on the $x$-axis. Label the top vertex with coordinates $(0,h)$, the left vertex with coordinate $(b_1,0)$, and the right vertex with coordinate $(b_2,0)$. \\
Note: with this notation we see the length of the base, $b$, is given by $b=b_2-b_1$.

\begin{problem}{1}
Draw the triangle as described above in the plane. \\
\textit{Solution:} 
\begin{center}
\begin{tikzpicture}[scale=0.6]
\draw[line width=1.5pt,<->] (0,-2) -- (0,5);
\draw[line width=1.5pt,<->] (-4,0) -- (5,0);
%\draw[->-=0.7, line width=1pt] (1,-5) -- (1,5);
%\draw (1.5,-0.5) node {$\lambda$};
\draw[fill=black] (0,3.4) circle (1ex);
\draw[fill=black] (-1,0) circle (1ex);
\draw[fill=black] (3,0) circle (1ex);
\draw[line width=1.5pt] (-1,0) -- (0,3.4);
\draw[line width=1.5pt] (3,0) -- (0,3.4);
\draw (-2,0.7) node {$(b_1,0)$};
\draw (3.8,0.7) node {$(b_2,0)$};
\draw (1,3.5) node {$(0,h)$};
\end{tikzpicture}
\end{center}
\end{problem}
\begin{problem}{1}
Find the (linear) equations of the left leg and the right leg of the triangle you drew in Problem~1. \\
\textit{Solution:} The slope of the left leg is $-\dfrac{h}{b_1}$ (notice that this is actually a positive number because $b_1$ is itself negative) and hence the equation of the left leg is $y=-\dfrac{h}{b_1}x+h$. The slope of the right leg is $-\dfrac{h}{b_2}$ and hence the equation of the right leg is $y=-\dfrac{h}{b_2}x+h$. 
\end{problem}

\begin{problem}{3}
Find the area of the triangle by computing the double integral over the triangle of the function $1$. That is, use the formula $\mathrm{area}(D)=\displaystyle\int\int_D 1 \mathrm{d}A$ to derive the area of triangle formula. \\
\textit{Hint: Note that the length of the base leg $b$ expressed in terms of $b_1$ and $b_2$ is $b=b_2-b_1$.} \\
\textit{Solution:} We shall use the formula $\mathrm{Area}(\bigtriangleup)=\displaystyle\iint\limits_{\bigtriangleup} 1 \mathrm{d}A$ in our triangle. We now draw the region of integration:
\begin{center}
\begin{tikzpicture}[scale=0.6]
\draw[line width=1.5pt,<->] (0,-2) -- (0,5);
\draw[line width=1.5pt,<->] (-4,0) -- (5,0);
%\draw[->-=0.7, line width=1pt] (1,-5) -- (1,5);
%\draw (1.5,-0.5) node {$\lambda$};
\draw[line width=1.5pt] (-1,0) -- (0,3.4);
\draw[line width=1.5pt] (3,0) -- (0,3.4);
\draw (-2,0.7) node {$(b_1,0)$};
\draw (3.8,0.7) node {$(b_2,0)$};
\draw (1,3.5) node {$(0,h)$};
\draw[top color=gray, bottom color=gray] (-1,0) -- (0,3.4) -- (3,0) -- cycle;
\draw[color=red,->] (-2,2) -- (3,2);
\draw[fill=red] (-0.45,2) circle (1ex);
\draw[fill=red] (1.25,2) circle (1ex);
\draw[color=red] (-3,2.5) node {$x=b_1-\frac{b_1}{h}y$};
\draw[color=red] (4,2.5) node {$x=b_2-\frac{b_2}{h}y$};
\draw[fill=black] (0,3.4) circle (1ex);
\draw[fill=black] (-1,0) circle (1ex);
\draw[fill=black] (3,0) circle (1ex);
\end{tikzpicture}
\end{center} 
\end{problem}
If we chose to do this integral as $\mathrm{d}y\mathrm{d}x$ we would have to evaluate two integrals (why?). Hence we will do this integral as $\mathrm{d}x\mathrm{d}y$. Thus we have
$$\begin{array}{ll}
\mathrm{Area}(\bigtriangleup) &= \displaystyle\iint\limits_{\bigtriangleup} 1 \hspace{2pt}\mathrm{d}A \\
&= \displaystyle\int_0^h\int_{b_1-\frac{b_1}{h}y}^{b_2-\frac{b_2}{h}y} 1 \hspace{2pt}\mathrm{d}x\mathrm{d}y \\
&=\displaystyle\int_0^h (b_2-b_1) - \dfrac{b_2-b_1}{h}y \hspace{2pt} \mathrm{d}y \\
&= \displaystyle\int_0^h b - \dfrac{b}{h}y \hspace{2pt}\mathrm{d}y \\
&= by - \dfrac{b}{2h} y^2 \Bigg|_0^h \\
&=bh - \dfrac{b}{2h}h^2 \\
&= bh - \dfrac{b}{2h} \\
&= \dfrac{1}{2}bh,
\end{array}$$
as was to be shown.
\showpoints
\end{document}